﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GenerateAdminPage.Classes.DBStructure
{
    /// <summary>
    /// Represents list of data type corresponding with data type loaded from DB server
    /// </summary>
    public enum DataType
    {
        INT,
        STRING,
        GUILD,
        DATETIME,
        BOOL,
        FLOAT,
        DOUBLE,
        LONG,
        IMAGE
    }

    /// <summary>
    /// Represents for each attribute of table
    /// </summary>
    public class Attribute
    {
        /// <summary>
        /// Name of attribute, this name is same with name of corresponding column in DB server
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// Data type of attribute corresponding with data type of column of table in DB server
        /// </summary>
        public DataType Type { get; set; }

        /// <summary>
        /// Checking if attribute is primary key
        /// </summary>
        public bool IsPrimaryKey { get; set; }

        /// <summary>
        /// Checking if attribute is foreign key
        /// </summary>
        public bool IsForeignKey { get; set; }

        /// <summary>
        /// Name of table that a attribute is foreign key refer to 
        /// </summary>
        public string ReferTo { get; set; }

        /// <summary>
        /// Checking if a attribute is primary key and identify
        /// </summary>
        public bool IsIdentify { get; set; }

        /// <summary>
        /// Initialize a attribute
        /// </summary>
        public Attribute()
        {
            Name = "";
            Type = DataType.STRING;
            IsPrimaryKey = false;
            IsForeignKey = false;
            ReferTo = "";
            IsIdentify = false;
        }
    }
}
